package _18_设计模式._2_结构型模式._3_组合;

import java.util.ArrayList;
import java.util.List;

public class CommentNode implements Node{

    private String text;
    private List<Node> list = new ArrayList<>();

    public CommentNode(String text){
        this.text = text;
    }

    @Override
    public Node add(Node node){
        throw new UnsupportedOperationException();
    }

    @Override
    public List<Node> children(){
        return list;
    }

    @Override
    public String toXml(){
        return "<!-- " + text + " -->";
    }

}
